package com.jorado.ognl;

import java.util.Collection;
import java.util.Map;

/**
 * @Auther: len.zhang
 * @Date: 2019/8/14 11:13
 * @Description:
 */
public interface Consts {

    static boolean isBlank(final CharSequence cs) {
        int strLen;
        if (cs == null || (strLen = cs.length()) == 0) {
            return true;
        }
        for (int i = 0; i < strLen; i++) {
            if (!Character.isWhitespace(cs.charAt(i))) {
                return false;
            }
        }
        return true;
    }

    static boolean isNotBlank(final CharSequence cs) {
        return !isBlank(cs);
    }

    static boolean isEmpty(Collection<?> collection) {
        return (collection == null || collection.isEmpty());
    }

    static boolean isEmpty(Map<?, ?> map) {
        return (map == null || map.isEmpty());
    }

    static boolean isNotEmpty(Collection<?> collection) {
        return !isEmpty(collection);
    }

    static boolean isNotEmpty(Map<?, ?> map) {
        return !isEmpty(map);
    }
}
